# ifndef __CitiesList_H_
# define __CitiesList_H_

# include "ListView.h"
# include "Map.h"

class CDialogBase;

class CCitiesList {
  public:
	CCitiesList (bool _bShowCount, bool _bShowNoCity) :
		m_bShowCount (_bShowCount),
		m_bShowNoCity (_bShowNoCity)
	{}

	void Init (HWND _hwndParent, WORD _wID);
	void Destroy ();
	void Activate (bool _bSelect, const city_t * _pCity = NULL);

	bool OnParentNotify (int _idCtrl, NMHDR * _pInfo, CDialogBase * _pDialog);

	size_t GetCities () const;
	city_t * GetSelCity () const;

	void InsertLastCity ();
	void EditSelCity ();
	bool RemoveSelCity ();
	void LocateSelCity ();
	bool IsCityLocatable (size_t _cIndex);

  private:
	CListView m_List;
	const bool m_bShowCount;
	const bool m_bShowNoCity;

	std::vector<cities_t::iterator> m_vecCities;
	cities_t::iterator m_iNoCity;

	void _PrepareCities ();
	void _FillCities (bool _bSelect, const city_t * _pCity);
	void _SortCities ();
};

# endif // __CitiesList_H_